filtering for incidents with no priority

Hi I am trying to get a list of incidents that don’t have their priority set-up.

curl -X GET --header ‘Accept: application/vnd.pagerduty+json;version=2’ --header ‘Authorization: Token token=*******************’ ‘https://api.pagerduty.com/incidents?since=2019-02-27T15%3A07%3A42&until=2019-02-27T15%3A08%3A42&statuses[]=resolved&urgencies[]=high&time_zone=EST&priority=null’

using &priority=null’ but I am still getting all the incidents … I am not sure what I am doing wrong.

Hi Basma,

Could you try this:

curl -X GET --header 'Accept: application/vnd.pagerduty+json;version=2' --header 'Authorization: Token token=TOKEN-HERE' 'https://api.pagerduty.com/incidents?time_zone=UTC'

Please note that this endpoint only works for Triggered incidents. For information about Resolved incidents you would need to use the log entries endpoint.

You could also exclude priority instead of setting it as null.

Cheers,
Monica

Hi Monica,
What I am trying to accomplish is getting a list of incident that doesn’t have priority yet … when running the above curl you provided I am getting a full list of incidents …

You are able to use the following curl to get a list of triggered incidents that have no priority set.

curl -X GET --header 'Accept: application/vnd.pagerduty+json;version=2' --header 'Authorization: Token token=TOKEN-HERE' 'https://api.pagerduty.com/incidents?time_zone=UTC'

Note that this will not work for resolved incidents. For resolved incidents, you can use the log_entries endpoint.

Hi Thomas,
If I use the above curl I am getting even the incidents which have their priorities setup too.

Hi Basma, the best way to view incidents with/without priority is to obtain a list of all incidents via that Curl command and then parse through to filter the list of incidents with the entry for "priority": null as it’s not supported as a filter via the Curl command alone.